﻿#pragma once
#include <functional>
#include <algorithm>
#include "character.h"


namespace lix {

	class Text {
	public:

		static inline bool isEmpty(const char* pch ){
			return ( pch == 0 || *pch == 0 );
		}
		
		static inline bool startsWith( const char* target, const char* find){
			if( target == NULL) return find == NULL;
			if( *target == 0 ) return isEmpty( find );
			if( isEmpty( find )) return false;

			while( true ){
				if( * find == 0 ) return true;
				if( *target != *find) return false;
				++target;
				++find;
			}
		}
	
		template<class RANGE>
		static bool isWhiteSpace(const RANGE& range ){
			return std::find_if(
				range.begin(),
				range.end(),
				std::not1( std::ptr_fun( Character::isWhiteSpace<RANGE::value_type>))
			) == range.end();
		}

		



	};

}